﻿using demo.Interfaces;
using demo.Models;

namespace demo.Services
{
    public class CategoryService : ICategoryService
    {
        private readonly IRepository<Category> _categoryRepository;

        public CategoryService(IRepository<Category> categoryRepository)
        {
            _categoryRepository = categoryRepository;
        }

        public async Task<List<Category>> GetAllCategoriesAsync()
        {
            return await _categoryRepository.GetAllAsync();
        }

        //public async Task<List<SubCategory>> GetSubCategoriesByCategoryIdAsync(int categoryId)
        //{
        //    var category = await _categoryRepository.GetByIdAsync(categoryId);
        //    return category?.SubCategories.ToList() ?? new List<SubCategory>();
        //}
    }
}
